<%
    HttpServletRequest req1=(HttpServletRequest) request;
    String RequestUrl= req1.getRequestURI();
    String[] token = RequestUrl.split("/");
    String filename = token[token.length-1];
    out.println(filename);
%>
<div id="logo">
	<a href="index.jsp"><img src="images/logo.png" alt="Logo" width="300" height="100" /></a>
</div>
<div id="menu">
	<ul>
		<li id="menuhome"><a href="index.jsp">HOME</a></li>
		<li id="menudkonten"><a href="dkonten.jsp">CONTENT LIST</a></li>
                <%
                    if (session.getAttribute("username")==null)
                        out.println("<li id=\"menuregister\"><a href=\"register.jsp\">REGISTER</a></li>");
                    else
                        out.println("<li id=\"menuprofile\"><a href=\"profile.jsp?uid="+session.getAttribute("username")+"\">PROFILE</a></li>");
                %>
	</ul>
</div>
<div id="usearch">
	<ul>
		<li id="user">
		<b>
			USERNAME <input id="username" class="textfld" type="text" name="username"/>
			<input onclick="login()" class="btn" type="submit" value="Login"/></<br />
			PASSWORD <input id="passwd" class="textfld" type="password" name="passwd"/>
			<div id="loginResultDiv">
			</div>
		</b>
			<table border="0">
				<tr>
					<td rowspan="2" width="45"><img src="ava/<?echo $_SESSION['username']?>.jpg" alt="avatar" class="ava-img"/></td>
					<td>Welcome, <b></b>!</td>
				</tr>
				<tr>
					<td><a href="prologout.php">logout</a></td>
				</tr>
			</table>
		</li>
		<li id="search">
			<i>Search</i> <input id="searchbar" class="textfld" type="text" name="search"/>
			<select id="searchopt">
				<option>All</option>
				<option>User</option>
				<option>Content</option>
			</select>
			<input onclick="search()" class="btn" type="submit" value="Search"/>
		</li>
	</ul>
</div>
